﻿@using HiLand.General.Entity
@using GBFinance.Web.Controllers
@model LoanBasicEntity
@using HiLand.Utility4.MVC.Controls
@using GBFinance.Web.Control
@using HiLand.Utility4.MVC.Data
@{
    Layout = null;

    MvcControlUsingModes usingMode = (this.ViewContext.Controller as GBFinance.Web.Controllers.BaseLoanController).GetUsingMode();
    bool isPopLayer = (this.ViewContext.Controller as GBFinance.Web.Controllers.BaseLoanController).CheckIsPopLayer();

    int LoansAmountMax = this.GetPassedParam<LoanBasicEntity, int>("LoansAmountMax");
    int LoansAmountMin = this.GetPassedParam<LoanBasicEntity, int>("LoansAmountMin");
}
<div id="UInitialLoanInformationContainer">
    @using (Html.BeginForm())
    {
        <fieldset id="securedDetails" class="simpleFieldset">
            <legend>Initial Loan Details</legend>
            <table>
                <tr>
                    <td>@Html.HiTextBox().UsingMode(usingMode).Name("LoanAmount").Value(Model.LoanAmount.ToString()).Lable("Amount Required").Render()
                    </td>
                </tr>
                <tr>
                    <td>@Html.GBFLoanTermCountDropDownList().UsingMode(usingMode).Name("LoanTermCount").Value(Model.LoanTermCount.ToString()).Lable("Loan Terms").Render()
                    </td>
                </tr>
                <tr>
                    <td>@Html.HiTextArea().UsingMode(usingMode).Name("LoanPurpose").Value(Model.LoanPurpose).Lable("Purpose").Render(new { rows = 8, cols = 40 })
                    </td>
                </tr>
            </table>
            @Html.HiddenFor(m => m.LoanGuid)
        </fieldset>
    }
    <script type="text/javascript">
            $(document).ready(function () {
                $("#UInitialLoanInformationContainer form").validate({
                    rules: {
                        LoanPurpose: {required:true},
                        LoanAmount: {range:[@LoansAmountMin,@LoansAmountMax]}
                    },
                    messages: {
                        LoanPurpose: "required",
                        LoanAmount:"range:[@LoansAmountMin,@LoansAmountMax]"
                    }
                });
            });
    </script>
    @if (isPopLayer == true)
    {
        <div class="notification attention png_bg">
            <a href="#" class="close">
                <img src="@Url.Content("~/Content/NotificationImages/cross_grey_small.png")" title="Close this notification" alt="close" /></a>
            <div class="notificationContent">
                You can close this PopWindow by the key "Esc".
            </div>
        </div>
        <input type="button" value="Save" id="btnSave" />
        <script type="text/javascript">
            $(document).ready(function () {
                $("#UInitialLoanInformationContainer #btnSave").click(function () {
                    submitAndRedirect("#UInitialLoanInformationContainer form");
                });
            });
        </script>
    }
</div>
